package com.uzai.common.utils;

import com.uzai.common.entity.*;
import com.uzai.common.enums.DeviceTypeEnum;

/**
 * @Auther: xiaoyuexl
 * @Date: 2021/8/28 16:15
 * @Description:
 */
public class UserUtil {
    public static User newUser(DeviceTypeEnum deviceTypeEnum){
        if (DeviceTypeEnum.DT_ANDROID_WECHAT.getKey().equals(deviceTypeEnum.getKey())){
            // 个人微信
            User user = new WechatUser();
            return user;
        }else if (DeviceTypeEnum.DT_WORK_WECHAT.getKey().equals(deviceTypeEnum.getKey())){
            // 企业微信
            User user = new WxworkUser();
            return user;
        }else if(DeviceTypeEnum.WX_PUB.getKey().equals(deviceTypeEnum.getKey())){
            // 公众号
            User user = new WxpubUser();
            return user;
        }else if(DeviceTypeEnum.APP.getKey().equals(deviceTypeEnum.getKey())){
            // App
            User user = new AppUser();
            return user;
        }
        return null;
    }

    public static  String getRegSourceName(int source,DeviceTypeEnum deviceTypeEnum) {
        if (deviceTypeEnum.getKey().equals("private_wechat")) {
            //个微 17-个人微信卡片添加；14-个人微信群内添加；30个人微信扫描二维码添加；3个人微信搜索微信号添加; 1-个人微信QQ搜索添加
            if (source == 17) {
                return "卡片";
            } else if (source == 14) {
                return "群内";
            } else if (source == 30) {
                return "二维码";
            } else if (source == 3) {
                return "微信号";
            } else if (source == 1) {
                return "QQ号";
            } else {
                return "未知";
            }
        } else if (deviceTypeEnum.getKey().equals("work_wechat")) {
            //企微 1-企业微信扫描二维码添加；2-通过手机号搜索添加；3-好友分享名片添加；4-通过群添加}
            if (source == 1) {
                return "二维码";
            } else if (source == 2) {
                return "手机号";
            } else if (source == 3) {
                return "名片";
            } else if (source == 4) {
                return "群内";
            } else {
                return "未知";
            }
        }
        return "未知";
    }


}
